package com.yqz.sys.mapper;

import com.yqz.common.base.mapper.BaseMapper;
import com.yqz.sys.form.CompUserRoleRefForm;
import com.yqz.sys.query.CompUserRoleRefQuery;
import com.yqz.sys.vo.CompUserRoleRefVO;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface CompUserRoleRefMapper extends BaseMapper<CompUserRoleRefVO, CompUserRoleRefQuery, CompUserRoleRefForm> {
    /**
     * 根据公司和用户ID查询所有角色
     * @param compId
     * @param uId
     * @return
     */
    List<CompUserRoleRefVO> findByCompIdAndUId(@Param("compId")Integer compId, @Param("uId")Integer uId);
    /**
     * 根据角色统计 有多少用户使用该角色
     * @param rId
     * @return
     */
    Integer findCountByRId(@Param("rId")Integer rId);
    /**
     * 根据用户ID删除用户角色
     * @param uId
     * @return
     */
    Integer deleteByUId(@Param("uId")Integer uId);
    /**
     * 根据用户ID查询角色ID
     * @param uId
     * @return
     */
    List<Integer> findRolesByUId(@Param("uId")Integer uId);
    /**
     * 批量设置 角色
     * @param uId
     * @param rId
     * @return
     */
    Integer batchInsert(@Param("uId") Integer uId,@Param("rIds")  List<Integer> rId,@Param("compId") Integer compId);
}